<?php
class GooglemapController extends AppController {

	public $name = 'googlemap';
		
	function beforeFilter() {
	    parent::beforeFilter(); 
		$this->C_auth->autoRedirect = false; //For override login
	    $this->C_auth->allowedActions = array('googlemap','showggmap');
	}

	public function showggmap()
    {	
		$position = Request::get_args('position');
		$title =Request::get_args('title');
		list($position_x,$position_y)=explode(',',$position);	
		$www_url= Request::$base;
		$gg_map_api = Param::read('Map.googleApi');		
		$this->set('gg_map_api',$gg_map_api);
		$this->set('www_url',$www_url);		
		$this->set('position_x',$position_x);		
		$this->set('position_y',$position_y);	
		$this->set('title',$title);		
	}
	public function googlemap()
    {
		$position = Request::get_args('position');
		list($position_x,$position_y)=explode(',',$position);
        $position_x >0 || $position_x=0;
        $position_y >0 || $position_y=0;
		$www_url= Request::$base;
		$gg_map_api = Param::read('Map.googleApi');		
        if(!$gg_map_api||($gg_map_api=='ABQIAAAAlNgPp05cAGeYiuhUaYZaQxT2hWcVQgqOjltVi_oi0-IXnv8sfRRB0xK-_hJ6X9fvCiWkheAw1gnL8Q'&&$www_url!='http://life.net')){
	        die('<a href="http://code.google.com/intl/zh-CN/apis/maps/signup.html" target="_blank">请先申请一个谷歌地图API密钥</a>');
        }
		$this->set('gg_map_api',$gg_map_api);
		$this->set('www_url',$www_url);		
		$this->set('position_x',$position_x);		
		$this->set('position_y',$position_y);
    }	

}


?>